package com.passncool.testbed.network;

import java.io.BufferedInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.Reader;
import java.io.Writer;
import java.net.InetAddress;
import java.net.Socket;
import java.net.UnknownHostException;

public class ClientSocket
{
    private static final int DEFALUT_PORT = 12000;
    private static final String HOST = "localhost";
    
    public static void main(String[] args)
    {
        try
        {
            InetAddress serverAddress = InetAddress.getByName(HOST);
            
            for(int i = 0; i < 1; i++)
            {
                Socket sock = new Socket(HOST,  DEFALUT_PORT);
                BufferedInputStream buffer = new BufferedInputStream(sock.getInputStream());
                InputStreamReader reader = new InputStreamReader(buffer, "8859_1");
                StringBuffer sb = new StringBuffer();
                
                int c;
                while( (c = reader.read()) != -1)
                {
                   
                    System.out.write(c);
                }
                
                reader.close();
                    
            }
        }
        catch(Exception e)
        {
            e.printStackTrace();
        }
       
        
    }
}
